<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" :path="path" :upload-url="uploadUrl" />
      <!--表格渲染-->
      <el-table border height="550" ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column v-if="columns.visible('projectCode')" prop="projectCode" label="项目编码·" />
        <el-table-column v-if="columns.visible('projectName')" prop="projectName" label="项目名称" />
        <el-table-column v-if="columns.visible('groupName')" prop="groupName" label="集团名称" />
        <el-table-column v-if="columns.visible('groupCode')" prop="groupCode" label="集团编码" />
        <el-table-column v-if="columns.visible('area')" prop="area" label="区域">
          <template slot-scope="scope">
            {{ dict.label.ict_project_attributive[scope.row.area] }}
          </template>
        </el-table-column>
        <el-table-column v-if="columns.visible('newOffice')" prop="newOffice" label="新办事处" />
        <el-table-column v-if="columns.visible('projectManager')" prop="projectManager" label="项目经理" />
        <el-table-column v-if="columns.visible('customerManager')" prop="customerManager" label="客户经理" />
        <el-table-column v-if="columns.visible('esopIctOutcomeTax')" prop="esopIctOutcomeTax" label="ESOP登记ICT出账收入（万元）-含税" />
        <el-table-column v-if="columns.visible('esopIctOutcomeNoTax')" prop="esopIctOutcomeNoTax" label="ESOP登记ICT出账收入（万元）-不含税" />
        <el-table-column v-if="columns.visible('esopOutcomeCheckTime')" prop="esopOutcomeCheckTime" label="ESOP登记出账审核完成时间">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.esopOutcomeCheckTime)}}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="columns.visible('productCode')" prop="productCode" label="产品编码" />
        <el-table-column v-if="columns.visible('industryType')" prop="industryType" label="项目行业类型">
          <template slot-scope="scope">
            {{ dict.label.ict_project_industry_type[scope.row.industryType] }}
          </template>
        </el-table-column>
        <el-table-column v-if="columns.visible('costName')" prop="costName" label="费项名称">
          <template slot-scope="scope">
            {{ dict.label.ict_cost_type[scope.row.costName] }}
          </template>
        </el-table-column>
        <el-table-column fixed="right" v-permission="['admin','ictStandingBook:edit','ictStandingBook:del']" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :path="path"
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudIctStandingBook from '@/api/ict/ictStandingBook/ictStandingBook'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.ict'
import udOperation from '@crud/UD.ict'
import pagination from '@crud/Pagination'

// crud交由presenter持有
const defaultCrud = CRUD({ title: '收入出账台账', url: 'api/ictStandingBook', sort: 'id,desc', crudMethod: { ...crudIctStandingBook }})
const defaultForm = { id: null, projectCode: null, projectName: null, groupName: null, groupCode: null, area: null, newOffice: null, projectManager: null, customerManager: null, esopIctOutcomeTax: null, esopIctOutcomeNoTax: null, esopOutcomeCheckTime: null, productCode: null, industryType: null, costName: null, delFlag: null, updateTime: null, createName: null }
export default {
  name: 'IctStandingBook',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
  dicts: ['ict_project_attributive', 'ict_project_industry_type', 'ict_cost_type', 'del_flag'],
  data() {
    return {
      path: '/ict/ictFinance/ictStandingBook/form',
      uploadUrl: '/api/ictStandingBook/import',
      permission: {
        add: ['admin', 'ictStandingBook:add'],
        edit: ['admin', 'ictStandingBook:edit'],
        del: ['admin', 'ictStandingBook:del']
      },
      rules: {
        id: [
          { required: true, message: '唯一id不能为空', trigger: 'blur' }
        ]
      }    }
  },
  methods: {
    // 获取数据前设置好接口地址
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
